﻿
$(document).ready(function(){
	getOrgInfo();
	getCertificateList();
	getAssumeProjectList();
	getInternalAuditList();
	getCommitteeList(1,1);
	getCommitteeList(1,2);
	getCommitteeList(2,1);
	getCommitteeList(2,2);
});

var editStatus = ''; 

function saveForm() {

	var organType = $("#organType").val();
	var organLevel = $("#organLevel").val();
	
	if(organType=='医院' && organLevel=='三级甲') {
	}else {
		$("#organLevel").focus();
		alert('提示：干细胞临床研究机构备案仅限于三级甲等医院！');
		return false;
	}
	
	var address = $("#address").val();
	var postCode = $("#postCode").val();
	var contactUser = $("#contactUser").val();
	var contactPhone = $("#contactPhone").val();
	var contactMobile = $("#contactMobile").val();
	var contactEmail = $("#contactEmail").val();
	var responsiblePerson = $("#responsiblePerson").val();
	
	// 备案信息
	var medicalInstitutionsExequaturPdf = $("#medicalInstitutionsExequaturPdf").val();
	var medicalInstitutionsExequaturSubject = $("#medicalInstitutionsExequaturSubject").val();
	var medicalInstitutionsExequaturStartDate = $("#medicalInstitutionsExequaturStartDate").val();
	var medicalInstitutionsExequaturEndDate = $("#medicalInstitutionsExequaturEndDate").val();
	var medicalInstitutionsExequaturRegisterNum = $("#medicalInstitutionsExequaturRegisterNum").val();
	var organizationScheme = $("#organizationScheme").val();
	var researchManagementPrincipalPdf = $("#researchManagementPrincipalPdf").val();
	var researchManagementPrincipalResponsible = $("#researchManagementPrincipalResponsible").val();
	var researchManagementAttorneyPdf = $("#researchManagementAttorneyPdf").val();
	var researchManagementAttorneyQualifiedPerson = $("#researchManagementAttorneyQualifiedPerson").val();
	var receiveTrainingPdf = $("#receiveTrainingPdf").val();
	var workingSystemPdf = $("#workingSystemPdf").val();
	var preparationStandardPdf = $("#preparationStandardPdf").val();
	var studyQualityManagementDocumentPdf = $("#studyQualityManagementDocumentPdf").val();
	var auditSystemPdf = $("#auditSystemPdf").val();
	var evaluationCriterionPdf = $("#evaluationCriterionPdf").val();
	var riskManagementMechanismPdf = $("#riskManagementMechanismPdf").val();
	var treatmentMeasurePdf = $("#treatmentMeasurePdf").val();
	// 2016-04-18 09:21:21
	var researchManagementPrincipalDuty = $("#researchManagementPrincipalDuty").val();
	var researchManagementPrincipalProfessional = $("#researchManagementPrincipalProfessional").val();
	var researchManagementPrincipalSpecialty = $("#researchManagementPrincipalSpecialty").val();
	var researchManagementPrincipalCertificatePdf = $("#researchManagementPrincipalCertificatePdf").val();
	var researchManagementAttorneyDuty = $("#researchManagementAttorneyDuty").val();
	var researchManagementAttorneyProfessional = $("#researchManagementAttorneyProfessional").val();
	var researchManagementAttorneySpecialty = $("#researchManagementAttorneySpecialty").val();
	var researchManagementAttorneyEducation = $("#researchManagementAttorneyEducation").val();
	var researchManagementAttorneyLimit = $("#researchManagementAttorneyLimit").val();
	var researchManagementAttorneyExperiencePdf = $("#researchManagementAttorneyExperiencePdf").val();
	var ethicalTrainingPdf = $("#ethicalTrainingPdf").val();
	var academicPdf = $("#academicPdf").val();
	var academicDirectorName = $("#academicDirectorName").val();
	var academicDirectorDuty = $("#academicDirectorDuty").val();
	var academicDirectorProfessional = $("#academicDirectorProfessional").val();
	var academicDirectorSpecialty = $("#academicDirectorSpecialty").val();
	var academicDirectorUnit = $("#academicDirectorUnit").val();
	var ethicalPdf = $("#ethicalPdf").val();
	var ethicalDirectorName = $("#ethicalDirectorName").val();
	var ethicalDirectorDuty = $("#ethicalDirectorDuty").val();
	var ethicalDirectorProfessional = $("#ethicalDirectorProfessional").val();
	var ethicalDirectorSpecialty = $("#ethicalDirectorSpecialty").val();
	var ethicalDirectorUnit = $("#ethicalDirectorUnit").val();
	var preparationStandardDevice = $("#preparationStandardDevice").val();
	var preparationStandardConditionPdf = $("#preparationStandardConditionPdf").val();
	var studyQualityManagementDocumentRoutine = $("#studyQualityManagementDocumentRoutine").val();
	var studyQualityManagementDocumentSheet = $("#studyQualityManagementDocumentSheet").val();
	var studyQualityManagementDocumentElse = $("#studyQualityManagementDocumentElse").val();
	var auditSystemEvidencePdf = $("#auditSystemEvidencePdf").val();
	var auditSystemInstitutionPdf = $("#auditSystemInstitutionPdf").val();
	var evaluationCriterionMonitoringDevice = $("#evaluationCriterionMonitoringDevice").val();
	var otherRelevantInformation = $("#otherRelevantInformation").val();
	
	$('span[id^="note_"]').html('');
	
	if(confirm('您确定要保存吗?')) {
		$.ajax({
	   		async:false,
			url:'/admin/org!saveOrgBySave.action',
			type:'post',
			data:{
				"organType": organType,
				"organLevel": organLevel,
				"address": address,
				"postCode": postCode,
				"contactUser": contactUser,
				"contactPhone": contactPhone,
				"contactMobile": contactMobile,
				"contactEmail": contactEmail,
				"responsiblePerson": responsiblePerson,
				"medicalInstitutionsExequaturPdf": medicalInstitutionsExequaturPdf,
				"medicalInstitutionsExequaturSubject": medicalInstitutionsExequaturSubject,
				"medicalInstitutionsExequaturStartDate": medicalInstitutionsExequaturStartDate,
				"medicalInstitutionsExequaturEndDate": medicalInstitutionsExequaturEndDate,
				"medicalInstitutionsExequaturRegisterNum": medicalInstitutionsExequaturRegisterNum,
				"organizationScheme": organizationScheme,
				"researchManagementPrincipalPdf": researchManagementPrincipalPdf,
				"researchManagementPrincipalResponsible": researchManagementPrincipalResponsible,
				"researchManagementAttorneyPdf": researchManagementAttorneyPdf,
				"researchManagementAttorneyQualifiedPerson": researchManagementAttorneyQualifiedPerson,
				"receiveTrainingPdf": receiveTrainingPdf,
				"workingSystemPdf": workingSystemPdf,
				"preparationStandardPdf": preparationStandardPdf,
				"studyQualityManagementDocumentPdf": studyQualityManagementDocumentPdf,
				"auditSystemPdf": auditSystemPdf,
				"evaluationCriterionPdf": evaluationCriterionPdf,
				"riskManagementMechanismPdf": riskManagementMechanismPdf,
				"researchManagementPrincipalDuty": researchManagementPrincipalDuty,
				"researchManagementPrincipalProfessional": researchManagementPrincipalProfessional,
				"researchManagementPrincipalSpecialty": researchManagementPrincipalSpecialty,
				"researchManagementPrincipalCertificatePdf": researchManagementPrincipalCertificatePdf,
				"researchManagementAttorneyDuty": researchManagementAttorneyDuty,
				"researchManagementAttorneyProfessional": researchManagementAttorneyProfessional,
				"researchManagementAttorneySpecialty": researchManagementAttorneySpecialty,
				"researchManagementAttorneyEducation": researchManagementAttorneyEducation,
				"researchManagementAttorneyLimit": researchManagementAttorneyLimit,
				"researchManagementAttorneyExperiencePdf": researchManagementAttorneyExperiencePdf,
				"ethicalTrainingPdf": ethicalTrainingPdf,
				"academicPdf": academicPdf,
				"academicDirectorName": academicDirectorName,
				"academicDirectorDuty": academicDirectorDuty,
				"academicDirectorProfessional": academicDirectorProfessional,
				"academicDirectorSpecialty": academicDirectorSpecialty,
				"academicDirectorUnit": academicDirectorUnit,
				"ethicalPdf": ethicalPdf,
				"ethicalDirectorName": ethicalDirectorName,
				"ethicalDirectorDuty": ethicalDirectorDuty,
				"ethicalDirectorProfessional": ethicalDirectorProfessional,
				"ethicalDirectorSpecialty": ethicalDirectorSpecialty,
				"ethicalDirectorUnit": ethicalDirectorUnit,
				"preparationStandardDevice": preparationStandardDevice,
				"preparationStandardConditionPdf": preparationStandardConditionPdf,
				"studyQualityManagementDocumentRoutine": studyQualityManagementDocumentRoutine,
				"studyQualityManagementDocumentSheet": studyQualityManagementDocumentSheet,
				"studyQualityManagementDocumentElse": studyQualityManagementDocumentElse,
				"auditSystemEvidencePdf": auditSystemEvidencePdf,
				"auditSystemInstitutionPdf": auditSystemInstitutionPdf,
				"evaluationCriterionMonitoringDevice": evaluationCriterionMonitoringDevice,
				"treatmentMeasurePdf": treatmentMeasurePdf,
				"otherRelevantInformation": otherRelevantInformation
			},
			dataType:'html',
			cache:false,
			success:function(data){
				Interceptor(data);
				if(data!=null && data=="success"){
					alert("保存成功，下次您还可以继续编辑备案信息！");
				}
			},
			error:function(error){
				//nexts(tag);
			}
		}); 
    	// 	
    }
}

function getProvinceList(){
	
	$.ajax({
   		async:false,
		url: '/admin/org!getProvinceList.action',
		type:'POST',
		dataType:'json',
		cache: false,
		success:function(data){
			Interceptor(data);
			var resultContent='';
			$(data).each(function(i) {
				resultContent+='<option value="'+data[i].code+'">'+data[i].name+'</option>';
			});
			$("#province").html(resultContent);
			
			getOrgInfo();
		}
	});
}

function getOrgInfo() {
	$.ajax({
   		async:false,
		url:'/admin/org!findUserOrgById.action',
		type:'POST',
		dataType:'json',
		cache: false,
		success:function(data){
			Interceptor(data);
			var sjreson="";
			var baocunIdStr="";
			
			if(data!=null){
				var dataObj=data.org;
				var dataorgRecords=data.orgRecords;
				var organizationRecordsCertificate=data.organizationRecordsCertificate;
				var status = dataObj.status;
				editStatus = dataorgRecords.status; 
				if(dataorgRecords.status!=null && dataorgRecords.status=='1') {
					$("#passDiv").show();
				}else {
					$("#passDiv").hide();
				}
				 
				$("#id").val(dataObj.ID);
				$("#name").val(dataObj.name);
				$("#organType").val(dataObj.organType);
				$("#organLevel").val(dataObj.organLevel);
				$("#organCode").val(dataObj.organCode);
				$("#address").val(dataObj.address);
				$("#postCode").val(dataObj.postCode);
				$("#contactUser").val(dataObj.contactUser);
				$("#contactPhone").val(dataObj.contactPhone);
				$("#contactMobile").val(dataObj.contactMobile);
				$("#contactEmail").val(dataObj.contactEmail);
				$("#province_li").html(dataObj.province.name);
				$("#responsiblePerson").val(dataObj.responsiblePerson);
				$("#regNumber").html("机构备案编号： " + dataorgRecords.regNumber);
				
				//2016-06-07 15:56:59
				$("#institutionEthicsCommitteeName").html(dataObj.institutionEthicsCommitteeName);
				$("#institutionEthicsCommitteePersonnel").html(dataObj.institutionEthicsCommitteePersonnel);
				if(dataObj.institutionEthicsCommitteeConstitution==1) {
					$("#institutionEthicsCommitteeConstitution").html("是");
				}else if(dataObj.institutionEthicsCommitteeConstitution==1) {
					$("#institutionEthicsCommitteeConstitution").html("否");
				}
				if(dataObj.institutionEthicsCommitteeProgram==1) {
					$("#institutionEthicsCommitteeProgram").html("是");
				}else if(dataObj.institutionEthicsCommitteeProgram==1) {
					$("#institutionEthicsCommitteeProgram").html("否");
				}
				
				
				if(dataorgRecords!=""){
					sjreson=dataorgRecords.reason;
					baocunIdStr=dataorgRecords.status;
					$("#status").val(baocunIdStr);
					// 机构备案
					$("#medicalInstitutionsExequaturPdf").val(dataorgRecords.medicalInstitutionsExequaturPdf);
					if(dataorgRecords.medicalInstitutionsExequaturPdf!=null && dataorgRecords.medicalInstitutionsExequaturPdf!='') {
						var array = dataorgRecords.medicalInstitutionsExequaturPdf.split('/');
						$("#medicalInstitutionsExequatur_span").html("已上传文件：<a href='" + dataorgRecords.medicalInstitutionsExequaturPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#medicalInstitutionsExequaturSubject").val(dataorgRecords.medicalInstitutionsExequaturSubject);
					$("#medicalInstitutionsExequaturStartDate").val(dataorgRecords.medicalInstitutionsExequaturStartDate);
					$("#medicalInstitutionsExequaturEndDate").val(dataorgRecords.medicalInstitutionsExequaturEndDate);
					$("#medicalInstitutionsExequaturRegisterNum").val(dataorgRecords.medicalInstitutionsExequaturRegisterNum);
					
					$("#organizationScheme").val(dataorgRecords.organizationScheme);
					if(dataorgRecords.organizationScheme!=null && dataorgRecords.organizationScheme!='') {
						var array = dataorgRecords.organizationScheme.split('/');
						$("#organizationScheme_span").html("已上传文件：<a href='" + dataorgRecords.organizationScheme + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#researchManagementPrincipalPdf").val(dataorgRecords.researchManagementPrincipalPdf);
					if(dataorgRecords.researchManagementPrincipalPdf!=null && dataorgRecords.researchManagementPrincipalPdf!='') {
						var array = dataorgRecords.researchManagementPrincipalPdf.split('/');
						$("#researchManagementPrincipal_span").html("已上传文件：<a href='" + dataorgRecords.researchManagementPrincipalPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#researchManagementPrincipalResponsible").val(dataorgRecords.researchManagementPrincipalResponsible);
					
					$("#researchManagementAttorneyPdf").val(dataorgRecords.researchManagementAttorneyPdf);
					if(dataorgRecords.researchManagementAttorneyPdf!=null && dataorgRecords.researchManagementAttorneyPdf!='') {
						var array = dataorgRecords.researchManagementAttorneyPdf.split('/');
						$("#researchManagementAttorney_span").html("已上传文件：<a href='" + dataorgRecords.researchManagementAttorneyPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#researchManagementAttorneyQualifiedPerson").val(dataorgRecords.researchManagementAttorneyQualifiedPerson);
					
					$("#receiveTrainingPdf").val(dataorgRecords.receiveTrainingPdf);
					if(dataorgRecords.receiveTrainingPdf!=null && dataorgRecords.receiveTrainingPdf!='') {
						var array = dataorgRecords.receiveTrainingPdf.split('/');
						$("#receiveTrainingPdf_span").html("已上传文件：<a href='" + dataorgRecords.receiveTrainingPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					
					
					$("#workingSystemPdf").val(dataorgRecords.workingSystemPdf);
					if(dataorgRecords.workingSystemPdf!=null && dataorgRecords.workingSystemPdf!='') {
						var array = dataorgRecords.workingSystemPdf.split('/');
						$("#workingSystemPdf_span").html("已上传文件：<a href='" + dataorgRecords.workingSystemPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					
					$("#preparationStandardPdf").val(dataorgRecords.preparationStandardPdf);
					if(dataorgRecords.preparationStandardPdf!=null && dataorgRecords.preparationStandardPdf!='') {
						var array = dataorgRecords.preparationStandardPdf.split('/');
						$("#preparationStandardPdf_span").html("已上传文件：<a href='" + dataorgRecords.preparationStandardPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					
					$("#studyQualityManagementDocumentPdf").val(dataorgRecords.studyQualityManagementDocumentPdf);
					if(dataorgRecords.studyQualityManagementDocumentPdf!=null && dataorgRecords.studyQualityManagementDocumentPdf!='') {
						var array = dataorgRecords.studyQualityManagementDocumentPdf.split('/');
						$("#studyQualityManagementDocumentPdf_span").html("已上传文件：<a href='" + dataorgRecords.studyQualityManagementDocumentPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					
					$("#auditSystemPdf").val(dataorgRecords.auditSystemPdf);
					if(dataorgRecords.auditSystemPdf!=null && dataorgRecords.auditSystemPdf!='') {
						var array = dataorgRecords.auditSystemPdf.split('/');
						$("#auditSystemPdf_span").html("已上传文件：<a href='" + dataorgRecords.auditSystemPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					
					$("#evaluationCriterionPdf").val(dataorgRecords.evaluationCriterionPdf);
					if(dataorgRecords.evaluationCriterionPdf!=null && dataorgRecords.evaluationCriterionPdf!='') {
						var array = dataorgRecords.evaluationCriterionPdf.split('/');
						$("#evaluationCriterionPdf_span").html("已上传文件：<a href='" + dataorgRecords.evaluationCriterionPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					
					$("#riskManagementMechanismPdf").val(dataorgRecords.riskManagementMechanismPdf);
					if(dataorgRecords.riskManagementMechanismPdf!=null && dataorgRecords.riskManagementMechanismPdf!='') {
						var array = dataorgRecords.riskManagementMechanismPdf.split('/');
						$("#riskManagementMechanismPdf_span").html("已上传文件：<a href='" + dataorgRecords.riskManagementMechanismPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					
					$("#treatmentMeasurePdf").val(dataorgRecords.treatmentMeasurePdf);
					if(dataorgRecords.treatmentMeasurePdf!=null && dataorgRecords.treatmentMeasurePdf!='') {
						var array = dataorgRecords.treatmentMeasurePdf.split('/');
						$("#treatmentMeasurePdf_span").html("已上传文件：<a href='" + dataorgRecords.treatmentMeasurePdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					//2016-04-21 13:38:00 xiaoan start
					$("#researchManagementPrincipalDuty").val(dataorgRecords.researchManagementPrincipalDuty);
					$("#researchManagementPrincipalProfessional").val(dataorgRecords.researchManagementPrincipalProfessional);
					$("#researchManagementPrincipalSpecialty").val(dataorgRecords.researchManagementPrincipalSpecialty);
					$("#researchManagementAttorneyDuty").val(dataorgRecords.researchManagementAttorneyDuty);
					$("#researchManagementAttorneyProfessional").val(dataorgRecords.researchManagementAttorneyProfessional);
					$("#researchManagementAttorneySpecialty").val(dataorgRecords.researchManagementAttorneySpecialty);
					$("#researchManagementAttorneyEducation").val(dataorgRecords.researchManagementAttorneyEducation);
					$("#researchManagementAttorneyLimit").val(dataorgRecords.researchManagementAttorneyLimit);
					$("#academicDirectorName").val(dataorgRecords.academicDirectorName);
					$("#academicDirectorDuty").val(dataorgRecords.academicDirectorDuty);
					$("#academicDirectorProfessional").val(dataorgRecords.academicDirectorProfessional);
					$("#academicDirectorSpecialty").val(dataorgRecords.academicDirectorSpecialty);
					$("#academicDirectorUnit").val(dataorgRecords.academicDirectorUnit);
					$("#ethicalDirectorName").val(dataorgRecords.ethicalDirectorName);
					$("#ethicalDirectorDuty").val(dataorgRecords.ethicalDirectorDuty);
					$("#ethicalDirectorProfessional").val(dataorgRecords.ethicalDirectorProfessional);
					$("#ethicalDirectorSpecialty").val(dataorgRecords.ethicalDirectorSpecialty);
					$("#ethicalDirectorUnit").val(dataorgRecords.ethicalDirectorUnit);
					$("#preparationStandardDevice").val(dataorgRecords.preparationStandardDevice);
					$("#evaluationCriterionMonitoringDevice").val(dataorgRecords.evaluationCriterionMonitoringDevice);
					$("#treatmentMeasurePdf").val(dataorgRecords.treatmentMeasurePdf);
					
					$("#otherRelevantInformation").val(dataorgRecords.otherRelevantInformation);
					if(dataorgRecords.otherRelevantInformation!=null && dataorgRecords.otherRelevantInformation!='') {
						var array = dataorgRecords.otherRelevantInformation.split('/');
						$("#otherRelevantInformation_span").html("已上传文件：<a href='" + dataorgRecords.otherRelevantInformation + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#auditSystemEvidencePdf").val(dataorgRecords.auditSystemEvidencePdf);
					if(dataorgRecords.auditSystemEvidencePdf!=null && dataorgRecords.auditSystemEvidencePdf!='') {
						var array = dataorgRecords.auditSystemEvidencePdf.split('/');
						$("#auditSystemEvidencePdf_span").html("已上传文件：<a href='" + dataorgRecords.auditSystemEvidencePdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#auditSystemInstitutionPdf").val(dataorgRecords.auditSystemInstitutionPdf);
					if(dataorgRecords.auditSystemInstitutionPdf!=null && dataorgRecords.auditSystemInstitutionPdf!='') {
						var array = dataorgRecords.auditSystemInstitutionPdf.split('/');
						$("#auditSystemInstitutionPdf_span").html("已上传文件：<a href='" + dataorgRecords.auditSystemInstitutionPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#preparationStandardConditionPdf").val(dataorgRecords.preparationStandardConditionPdf);
					if(dataorgRecords.preparationStandardConditionPdf!=null && dataorgRecords.preparationStandardConditionPdf!='') {
						var array = dataorgRecords.preparationStandardConditionPdf.split('/');
						$("#preparationStandardConditionPdf_span").html("已上传文件：<a href='" + dataorgRecords.preparationStandardConditionPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#ethicalPdf").val(dataorgRecords.ethicalPdf);
					if(dataorgRecords.ethicalPdf!=null && dataorgRecords.ethicalPdf!='') {
						var array = dataorgRecords.ethicalPdf.split('/');
						$("#ethicalPdf_span").html("已上传文件：<a href='" + dataorgRecords.ethicalPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#academicPdf").val(dataorgRecords.academicPdf);
					if(dataorgRecords.academicPdf!=null && dataorgRecords.academicPdf!='') {
						var array = dataorgRecords.academicPdf.split('/');
						$("#academicPdf_span").html("已上传文件：<a href='" + dataorgRecords.academicPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#ethicalTrainingPdf").val(dataorgRecords.ethicalTrainingPdf);
					if(dataorgRecords.ethicalTrainingPdf!=null && dataorgRecords.ethicalTrainingPdf!='') {
						var array = dataorgRecords.ethicalTrainingPdf.split('/');
						$("#ethicalTrainingPdf_span").html("已上传文件：<a href='" + dataorgRecords.ethicalTrainingPdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#researchManagementAttorneyExperiencePdf").val(dataorgRecords.researchManagementAttorneyExperiencePdf);
					if(dataorgRecords.researchManagementAttorneyExperiencePdf!=null && dataorgRecords.researchManagementAttorneyExperiencePdf!='') {
						var array = dataorgRecords.researchManagementAttorneyExperiencePdf.split('/');
						$("#researchManagementAttorneyExperiencePdf_span").html("已上传文件：<a href='" + dataorgRecords.researchManagementAttorneyExperiencePdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#researchManagementPrincipalCertificatePdf").val(dataorgRecords.researchManagementPrincipalCertificatePdf);
					if(dataorgRecords.researchManagementPrincipalCertificatePdf!=null && dataorgRecords.researchManagementPrincipalCertificatePdf!='') {
						var array = dataorgRecords.researchManagementPrincipalCertificatePdf.split('/');
						$("#researchManagementPrincipalCertificatePdf_span").html("已上传文件：<a href='" + dataorgRecords.researchManagementPrincipalCertificatePdf + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					//2016-04-21 13:38:00 xiaoan end
					$("#studyQualityManagementDocumentRoutine").val(dataorgRecords.studyQualityManagementDocumentRoutine);
					if(dataorgRecords.studyQualityManagementDocumentRoutine!=null && dataorgRecords.studyQualityManagementDocumentRoutine!='') {
						var array = dataorgRecords.studyQualityManagementDocumentRoutine.split('/');
						$("#studyQualityManagementDocumentRoutine_span").html("已上传文件：<a href='" + dataorgRecords.studyQualityManagementDocumentRoutine + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#studyQualityManagementDocumentSheet").val(dataorgRecords.studyQualityManagementDocumentSheet);
					if(dataorgRecords.studyQualityManagementDocumentSheet!=null && dataorgRecords.studyQualityManagementDocumentSheet!='') {
						var array = dataorgRecords.studyQualityManagementDocumentSheet.split('/');
						$("#studyQualityManagementDocumentSheet_span").html("已上传文件：<a href='" + dataorgRecords.studyQualityManagementDocumentSheet + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
					$("#studyQualityManagementDocumentElse").val(dataorgRecords.studyQualityManagementDocumentElse);
					if(dataorgRecords.studyQualityManagementDocumentElse!=null && dataorgRecords.studyQualityManagementDocumentElse!='') {
						var array = dataorgRecords.studyQualityManagementDocumentElse.split('/');
						$("#studyQualityManagementDocumentElse_span").html("已上传文件：<a href='" + dataorgRecords.studyQualityManagementDocumentElse + "' target='_blank'>" + array[array.length-1] + "</a>");
					}
				
				}

			}
			
			if(sjreson==""){
				$("#shenheId").hide();
				$("#reasonId").hide();
			}else{
				$("#shenheId").show();
				$("#reasonId").show();
				$("#sjreson").html(dataorgRecords.reason);
			}
			
			if(baocunIdStr==0){
				$("#baocunId").show();
				$("#tijiaoId").show();
			}else if(baocunIdStr==1){
				$("#baocunId").hide();
				$("#tijiaoId").hide();
			}
			
		},
		error:function(){
			//nexts(tag);
		}
	});
}

// 上传文件
KindEditor.ready(function(K) {

	var editor = K.editor({
		uploadJson : '/js/kindeditor-4.1.10/jsp/upload_json.jsp'
		//fileManagerJson : '/assets/plugins/kindeditor-4.1.10/jsp/file_manager_json.jsp',
		//allowFileManager : true
	});
	
	//医疗机构执业许可证书复印件（PDF）
	K('#medicalInstitutionsExequatur_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#medicalInstitutionsExequaturPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#medicalInstitutionsExequaturPdf").val(url);
					var array = url.split('/');
					$("#medicalInstitutionsExequatur_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	//药物临床试验机构资格认定证书复印件（PDF）
	K('#medicalClinicalTestCertificate_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#pdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#pdf").val(url);
					var array = url.split('/');
					$("#medicalClinicalTestCertificate_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	//机构干细胞临床研究组织管理体系（框架图）和各部门职责（PDF）
	K('#organizationScheme_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#organizationScheme').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#organizationScheme").val(url);
					var array = url.split('/');
					$("#organizationScheme_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	//机构干细胞临床研究管理主要责任人（PDF）
	K('#researchManagementPrincipal_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#researchManagementPrincipalPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#researchManagementPrincipalPdf").val(url);
					var array = url.split('/');
					$("#researchManagementPrincipal_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	//机构干细胞临床研究质量受权人资质（PDF）
	K('#researchManagementAttorney_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#researchManagementAttorneyPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#researchManagementAttorneyPdf").val(url);
					var array = url.split('/');
					$("#researchManagementAttorney_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	K('#receiveTrainingPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#receiveTrainingPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#receiveTrainingPdf").val(url);
					var array = url.split('/');
					$("#receiveTrainingPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
 
	K('#workingSystemPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#workingSystemPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#workingSystemPdf").val(url);
					var array = url.split('/');
					$("#workingSystemPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#preparationStandardPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#preparationStandardPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#preparationStandardPdf").val(url);
					var array = url.split('/');
					$("#preparationStandardPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#studyQualityManagementDocumentPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#studyQualityManagementDocumentPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#studyQualityManagementDocumentPdf").val(url);
					var array = url.split('/');
					$("#studyQualityManagementDocumentPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#auditSystemPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#auditSystemPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#auditSystemPdf").val(url);
					var array = url.split('/');
					$("#auditSystemPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#evaluationCriterionPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#evaluationCriterionPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#evaluationCriterionPdf").val(url);
					var array = url.split('/');
					$("#evaluationCriterionPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#riskManagementMechanismPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#riskManagementMechanismPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#riskManagementMechanismPdf").val(url);
					var array = url.split('/');
					$("#riskManagementMechanismPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	K('#treatmentMeasurePdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#treatmentMeasurePdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#treatmentMeasurePdf").val(url);
					var array = url.split('/');
					$("#treatmentMeasurePdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	K('#researchManagementPrincipalCertificatePdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#researchManagementPrincipalCertificatePdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#researchManagementPrincipalCertificatePdf").val(url);
					var array = url.split('/');
					$("#researchManagementPrincipalCertificatePdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	// researchManagementAttorneyExperiencePdf
	K('#researchManagementAttorneyExperiencePdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#researchManagementAttorneyExperiencePdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#researchManagementAttorneyExperiencePdf").val(url);
					var array = url.split('/');
					$("#researchManagementAttorneyExperiencePdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#ethicalTrainingPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#ethicalTrainingPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#ethicalTrainingPdf").val(url);
					var array = url.split('/');
					$("#ethicalTrainingPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#academicPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#academicPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#academicPdf").val(url);
					var array = url.split('/');
					$("#academicPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#ethicalPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#ethicalPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#ethicalPdf").val(url);
					var array = url.split('/');
					$("#ethicalPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	//preparationStandardConditionPdf
	K('#preparationStandardConditionPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#preparationStandardConditionPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#preparationStandardConditionPdf").val(url);
					var array = url.split('/');
					$("#preparationStandardConditionPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#auditSystemEvidencePdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#auditSystemEvidencePdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#auditSystemEvidencePdf").val(url);
					var array = url.split('/');
					$("#auditSystemEvidencePdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#auditSystemInstitutionPdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#auditSystemInstitutionPdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#auditSystemInstitutionPdf").val(url);
					var array = url.split('/');
					$("#auditSystemInstitutionPdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#otherRelevantInformation_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#otherRelevantInformation').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#otherRelevantInformation").val(url);
					var array = url.split('/');
					$("#otherRelevantInformation_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
	// 2016-04-25 09:33:13
	K('#studyQualityManagementDocumentRoutine_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#studyQualityManagementDocumentRoutine').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#studyQualityManagementDocumentRoutine").val(url);
					var array = url.split('/');
					$("#studyQualityManagementDocumentRoutine_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#studyQualityManagementDocumentSheet_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#studyQualityManagementDocumentSheet').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#studyQualityManagementDocumentSheet").val(url);
					var array = url.split('/');
					$("#studyQualityManagementDocumentSheet_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	K('#studyQualityManagementDocumentElse_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#studyQualityManagementDocumentElse').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#studyQualityManagementDocumentElse").val(url);
					var array = url.split('/');
					$("#studyQualityManagementDocumentElse_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
});

function organTypeHandle(value){
  if(value=='其他') {
  	$("#ul_organLevel").hide();
  }else if(value=='医院') {
  	$("#ul_organLevel").show();
  }
}

function submitForm() {

	var organType = $("#organType").val();
	var organLevel = $("#organLevel").val();
	
	if(organType=='医院' && organLevel=='三级甲') {
	}else {
		$("#organLevel").focus();
		alert('提示：干细胞临床研究机构备案仅限于三级甲等医院！');
		return false;
	}
	
	var address = $("#address").val();
	var postCode = $("#postCode").val();
	var contactUser = $("#contactUser").val();
	var contactPhone = $("#contactPhone").val();
	var contactMobile = $("#contactMobile").val();
	var contactEmail = $("#contactEmail").val();
	var responsiblePerson = $("#responsiblePerson").val();
	
	// 备案信息
	var medicalInstitutionsExequaturPdf = $("#medicalInstitutionsExequaturPdf").val();
	var medicalInstitutionsExequaturSubject = $("#medicalInstitutionsExequaturSubject").val();
	var medicalInstitutionsExequaturStartDate = $("#medicalInstitutionsExequaturStartDate").val();
	var medicalInstitutionsExequaturEndDate = $("#medicalInstitutionsExequaturEndDate").val();
	var medicalInstitutionsExequaturRegisterNum = $("#medicalInstitutionsExequaturRegisterNum").val();
	var organizationScheme = $("#organizationScheme").val();
	var researchManagementPrincipalPdf = $("#researchManagementPrincipalPdf").val();
	var researchManagementPrincipalResponsible = $("#researchManagementPrincipalResponsible").val();
	var researchManagementAttorneyPdf = $("#researchManagementAttorneyPdf").val();
	var researchManagementAttorneyQualifiedPerson = $("#researchManagementAttorneyQualifiedPerson").val();
	var receiveTrainingPdf = $("#receiveTrainingPdf").val();
	var workingSystemPdf = $("#workingSystemPdf").val();
	var preparationStandardPdf = $("#preparationStandardPdf").val();
	var studyQualityManagementDocumentPdf = $("#studyQualityManagementDocumentPdf").val();
	var auditSystemPdf = $("#auditSystemPdf").val();
	var evaluationCriterionPdf = $("#evaluationCriterionPdf").val();
	var riskManagementMechanismPdf = $("#riskManagementMechanismPdf").val();
	var treatmentMeasurePdf = $("#treatmentMeasurePdf").val();
	// 2016-04-18 09:21:21
	var researchManagementPrincipalDuty = $("#researchManagementPrincipalDuty").val();
	var researchManagementPrincipalProfessional = $("#researchManagementPrincipalProfessional").val();
	var researchManagementPrincipalSpecialty = $("#researchManagementPrincipalSpecialty").val();
	var researchManagementPrincipalCertificatePdf = $("#researchManagementPrincipalCertificatePdf").val();
	var researchManagementAttorneyDuty = $("#researchManagementAttorneyDuty").val();
	var researchManagementAttorneyProfessional = $("#researchManagementAttorneyProfessional").val();
	var researchManagementAttorneySpecialty = $("#researchManagementAttorneySpecialty").val();
	var researchManagementAttorneyEducation = $("#researchManagementAttorneyEducation").val();
	var researchManagementAttorneyLimit = $("#researchManagementAttorneyLimit").val();
	var researchManagementAttorneyExperiencePdf = $("#researchManagementAttorneyExperiencePdf").val();
	var ethicalTrainingPdf = $("#ethicalTrainingPdf").val();
	var academicPdf = $("#academicPdf").val();
	var academicDirectorName = $("#academicDirectorName").val();
	var academicDirectorDuty = $("#academicDirectorDuty").val();
	var academicDirectorProfessional = $("#academicDirectorProfessional").val();
	var academicDirectorSpecialty = $("#academicDirectorSpecialty").val();
	var academicDirectorUnit = $("#academicDirectorUnit").val();
	var ethicalPdf = $("#ethicalPdf").val();
	var ethicalDirectorName = $("#ethicalDirectorName").val();
	var ethicalDirectorDuty = $("#ethicalDirectorDuty").val();
	var ethicalDirectorProfessional = $("#ethicalDirectorProfessional").val();
	var ethicalDirectorSpecialty = $("#ethicalDirectorSpecialty").val();
	var ethicalDirectorUnit = $("#ethicalDirectorUnit").val();
	var preparationStandardDevice = $("#preparationStandardDevice").val();
	var preparationStandardConditionPdf = $("#preparationStandardConditionPdf").val();
	var studyQualityManagementDocumentRoutine = $("#studyQualityManagementDocumentRoutine").val();
	var studyQualityManagementDocumentSheet = $("#studyQualityManagementDocumentSheet").val();
	var studyQualityManagementDocumentElse = $("#studyQualityManagementDocumentElse").val();
	var auditSystemEvidencePdf = $("#auditSystemEvidencePdf").val();
	var auditSystemInstitutionPdf = $("#auditSystemInstitutionPdf").val();
	var evaluationCriterionMonitoringDevice = $("#evaluationCriterionMonitoringDevice").val();
	var otherRelevantInformation = $("#otherRelevantInformation").val();
	
	$('span[id^="note_"]').html('');
	
	if($.trim(organType)==''){
	  	$("#note_organType").html(' <font style="color:red;">机构类型不可以为空</font>');
	  	$("#organType").focus();
		return false;
	}
	if($.trim(organLevel)==''){
	  	$("#note_organLevel").html(' <font style="color:red;">机构等级不可以为空</font>');
	  	$("#organLevel").focus();
		return false;
	}
	 
	if($.trim(address)==''){
	  	$("#note_address").html(' <font style="color:red;">地址不可以为空</font>');
	  	$("#address").focus();
		return false;
	}
	if($.trim(postCode)==''){
	  	$("#note_postCode").html(' <font style="color:red;">邮编不可以为空</font>');
	  	$("#postCode").focus();
		return false;
	}
	if($.trim(contactUser)==''){
	  	$("#note_contactUser").html(' <font style="color:red;">联系人不可以为空</font>');
	  	$("#contactUser").focus();
		return false;
	}
	if($.trim(responsiblePerson)==''){
	  	$("#note_responsiblePerson").html(' <font style="color:red;">机构负责人不可以为空</font>');
	  	$("#responsiblePerson").focus();
		return false;
	}
	if($.trim(contactPhone)==''){
	  	$("#note_contactPhone").html(' <font style="color:red;">联系人电话不可以为空</font>');
	  	$("#contactPhone").focus();
		return false;
	}
	if($.trim(contactMobile)==''){
	  	$("#note_contactMobile").html(' <font style="color:red;">联系人手机不可以为空</font>');
	  	$("#contactMobile").focus();
		return false;
	}
	if($.trim(contactEmail)==''){
	  	$("#note_contactEmail").html(' <font style="color:red;">联系人邮箱不可以为空</font>');
	  	$("#contactEmail").focus();
		return false;
	}
	 
	if($.trim(medicalInstitutionsExequaturPdf)==''){
	  	$("#note_medicalInstitutionsExequatur").html(' <font style="color:red;">医疗机构执行许可证书-复印件不可以为空</font>');
		return false;
	}
	if($.trim(medicalInstitutionsExequaturSubject)==''){
	  	$("#note_medicalInstitutionsExequaturSubject").html(' <font style="color:red;">医疗机构执行许可证书-诊疗项目不可以为空</font>');
		return false;
	}
	if($.trim(medicalInstitutionsExequaturStartDate)=='' || $.trim(medicalInstitutionsExequaturEndDate)==''){
	  	$("#note_medicalInstitutionsExequaturDate").html(' <font style="color:red;">医疗机构执行许可证书-有效期不可以为空</font>');
		return false;
	}
	if($.trim(medicalInstitutionsExequaturRegisterNum)=='' || $.trim(medicalInstitutionsExequaturRegisterNum)==''){
	  	$("#note_medicalInstitutionsExequaturRegisterNum").html(' <font style="color:red;">医疗机构执行许可证书-登记号不可以为空</font>');
		return false;
	}
	if($.trim(organizationScheme)==''){
	  	$("#note_organizationScheme").html(' <font style="color:red;">机构干细胞临床研究组织管理体系（框架图）和各部门职责不可以为空!</font>');
		return false;
	}
	if($.trim(researchManagementPrincipalPdf)==''){
	  	$("#note_researchManagementPrincipal").html(' <font style="color:red;">机构干细胞临床研究管理主要责任人-复印件不可以为空</font>');
		return false;
	}
	if($.trim(researchManagementPrincipalResponsible)==''){
	  	$("#note_researchManagementPrincipalResponsible").html(' <font style="color:red;">机构干细胞临床研究管理主要责任人-负责人不可以为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneyPdf)==''){
	  	$("#note_researchManagementAttorney").html(' <font style="color:red;">机构干细胞临床研究质量受权人资质-复印件不可以为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneyQualifiedPerson)==''){
	  	$("#note_researchManagementAttorneyQualifiedPerson").html(' <font style="color:red;">机构干细胞临床研究质量受权人资质-质量受权人不可以为空</font>');
		return false;
	}
	
	if($.trim(receiveTrainingPdf)==''){
	  	$("#note_receiveTrainingPdf").html(' <font style="color:red;">相关人员接受培训资料不能为空</font>');
		return false;
	}
	 
	if($.trim(workingSystemPdf)==''){
	  	$("#note_workingSystemPdf").html(' <font style="color:red;">相应工作制度和标准操作规范不能为空</font>');
		return false;
	}
	if($.trim(preparationStandardPdf)==''){
	  	$("#note_preparationStandardPdf").html(' <font style="color:red;">干细胞制备标准操作规范不能为空</font>');
		return false;
	}
	if($.trim(studyQualityManagementDocumentPdf)==''){
	  	$("#note_studyQualityManagementDocumentPdf").html(' <font style="color:red;">干细胞临床研究质量管理文件不能为空</font>');
		return false;
	}
	if($.trim(auditSystemPdf)==''){
	  	$("#note_auditSystemPdf").html(' <font style="color:red;">干细胞临床研究审计体系不能为空</font>');
		return false;
	}
	if($.trim(evaluationCriterionPdf)==''){
	  	$("#note_evaluationCriterionPdf").html(' <font style="color:red;">干细胞评价标准不能为空</font>');
		return false;
	}
	if($.trim(riskManagementMechanismPdf)==''){
	  	$("#note_riskManagementMechanismPdf").html(' <font style="color:red;">预防干细胞临床研究风险管理机制不能为空</font>');
		return false;
	}
	if($.trim(treatmentMeasurePdf)==''){
	  	$("#note_treatmentMeasurePdf").html(' <font style="color:red;">预防干细胞临床研究风险处理不良反应、不良事件的措施不能为空</font>');
		return false;
	}
	// 2016-04-20 18:12:28
	if($.trim(researchManagementPrincipalDuty)==''){
	  	$("#note_researchManagementPrincipalDuty").html(' <font style="color:red;">职务不能为空</font>');
		return false;
	}
	if($.trim(researchManagementPrincipalProfessional)==''){
	  	$("#note_researchManagementPrincipalProfessional").html(' <font style="color:red;">职称不能为空</font>');
		return false;
	}
	if($.trim(researchManagementPrincipalSpecialty)==''){
	  	$("#note_researchManagementPrincipalSpecialty").html(' <font style="color:red;">专业不能为空</font>');
		return false;
	}
	if($.trim(researchManagementPrincipalCertificatePdf)==''){
	  	$("#note_researchManagementPrincipalCertificatePdf").html(' <font style="color:red;">文件不能为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneyDuty)==''){
	  	$("#note_researchManagementAttorneyDuty").html(' <font style="color:red;">职务不能为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneyProfessional)==''){
	  	$("#note_researchManagementAttorneyProfessional").html(' <font style="color:red;">职称不能为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneySpecialty)==''){
	  	$("#note_researchManagementAttorneySpecialty").html(' <font style="color:red;">专业不能为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneyEducation)==''){
	  	$("#note_researchManagementAttorneyEducation").html(' <font style="color:red;">学历不能为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneyLimit)==''){
	  	$("#note_researchManagementAttorneyLimit").html(' <font style="color:red;">从事干细胞制剂（或相关产品）制备和质量管理年限不能为空</font>');
		return false;
	}
	if($.trim(researchManagementAttorneyExperiencePdf)==''){
	  	$("#note_researchManagementAttorneyExperiencePdf").html(' <font style="color:red;">从事相关产品过程控制和质量检验工作经历不能为空</font>');
		return false;
	}
	if($.trim(ethicalTrainingPdf)==''){
	  	$("#note_ethicalTrainingPdf").html(' <font style="color:red;">主要研究人员伦理培训证书不能为空</font>');
		return false;
	}
	if($.trim(academicPdf)==''){
	  	$("#note_academicPdf").html(' <font style="color:red;">pdf资料不能为空</font>');
		return false;
	}
	if($.trim(academicDirectorName)==''){
	  	$("#note_academicDirectorName").html(' <font style="color:red;">主任委员姓名不能为空</font>');
		return false;
	}
	if($.trim(academicDirectorDuty)==''){
	  	$("#note_academicDirectorDuty").html(' <font style="color:red;">职务不能为空</font>');
		return false;
	}
	if($.trim(academicDirectorProfessional)==''){
	  	$("#note_academicDirectorProfessional").html(' <font style="color:red;">职称不能为空</font>');
		return false;
	}
	if($.trim(academicDirectorSpecialty)==''){
	  	$("#note_academicDirectorSpecialty").html(' <font style="color:red;">专业不能为空</font>');
		return false;
	}
	if($.trim(academicDirectorUnit)==''){
	  	$("#note_academicDirectorUnit").html(' <font style="color:red;">单位不能为空</font>');
		return false;
	}
	if($.trim(ethicalPdf)==''){
	  	$("#note_ethicalPdf").html(' <font style="color:red;">pdf资料不能为空</font>');
		return false;
	}
	if($.trim(ethicalDirectorName)==''){
	  	$("#note_ethicalDirectorName").html(' <font style="color:red;">主任委员姓名不能为空</font>');
		return false;
	}
	if($.trim(ethicalDirectorDuty)==''){
	  	$("#note_ethicalDirectorDuty").html(' <font style="color:red;">职务不能为空</font>');
		return false;
	}
	if($.trim(ethicalDirectorProfessional)==''){
	  	$("#note_ethicalDirectorProfessional").html(' <font style="color:red;">职称不能为空</font>');
		return false;
	}
	if($.trim(ethicalDirectorSpecialty)==''){
	  	$("#note_ethicalDirectorSpecialty").html(' <font style="color:red;">专业不能为空</font>');
		return false;
	}
	if($.trim(ethicalDirectorUnit)==''){
	  	$("#note_ethicalDirectorUnit").html(' <font style="color:red;">单位不能为空</font>');
		return false;
	}
	if($.trim(preparationStandardDevice)==''){
	  	$("#note_preparationStandardDevice").html(' <font style="color:red;">干细胞制备主要设施设备不能为空</font>');
		return false;
	}
	if($.trim(preparationStandardConditionPdf)==''){
	  	$("#note_preparationStandardConditionPdf").html(' <font style="color:red;">人员条件不能为空</font>');
		return false;
	}
	if($.trim(studyQualityManagementDocumentRoutine)==''){
	  	$("#note_studyQualityManagementDocumentRoutine").html(' <font style="color:red;">临床研究工作程序不能为空</font>');
		return false;
	}
	if($.trim(studyQualityManagementDocumentSheet)==''){
	  	$("#note_studyQualityManagementDocumentSheet").html(' <font style="color:red;">标准操作规范和试验记录不能为空</font>');
		return false;
	}
	if($.trim(studyQualityManagementDocumentElse)==''){
	  	$("#note_studyQualityManagementDocumentElse").html(' <font style="color:red;">其他不能为空</font>');
		return false;
	}
	if($.trim(auditSystemEvidencePdf)==''){
	  	$("#note_auditSystemEvidencePdf").html(' <font style="color:red;">证明文件不能为空</font>');
		return false;
	}
	if($.trim(auditSystemInstitutionPdf)==''){
	  	$("#note_auditSystemInstitutionPdf").html(' <font style="color:red;">外审（外部质量控制）制度（上传）不能为空</font>');
		return false;
	}
	if($.trim(evaluationCriterionMonitoringDevice)==''){
	  	$("#note_evaluationCriterionMonitoringDevice").html(' <font style="color:red;">干细胞检测设备设施情况不能为空</font>');
		return false;
	}
	if($.trim(otherRelevantInformation)==''){
	  	$("#note_otherRelevantInformation").html(' <font style="color:red;">其他相关材料（上传）不能为空</font>');
		return false;
	}
	if(confirm('您确定要提交吗?')) {
		$.ajax({
	   		async:false,
			url:'/admin/org!saveOrg.action',
			type:'post',
			data:{
				"organType": organType,
				"organLevel": organLevel,
				"address": address,
				"postCode": postCode,
				"contactUser": contactUser,
				"contactPhone": contactPhone,
				"contactMobile": contactMobile,
				"contactEmail": contactEmail,
				"responsiblePerson": responsiblePerson,
				"medicalInstitutionsExequaturPdf": medicalInstitutionsExequaturPdf,
				"medicalInstitutionsExequaturSubject": medicalInstitutionsExequaturSubject,
				"medicalInstitutionsExequaturStartDate": medicalInstitutionsExequaturStartDate,
				"medicalInstitutionsExequaturEndDate": medicalInstitutionsExequaturEndDate,
				"medicalInstitutionsExequaturRegisterNum": medicalInstitutionsExequaturRegisterNum,
				"organizationScheme": organizationScheme,
				"researchManagementPrincipalPdf": researchManagementPrincipalPdf,
				"researchManagementPrincipalResponsible": researchManagementPrincipalResponsible,
				"researchManagementAttorneyPdf": researchManagementAttorneyPdf,
				"researchManagementAttorneyQualifiedPerson": researchManagementAttorneyQualifiedPerson,
				"receiveTrainingPdf": receiveTrainingPdf,
				"workingSystemPdf": workingSystemPdf,
				"preparationStandardPdf": preparationStandardPdf,
				"studyQualityManagementDocumentPdf": studyQualityManagementDocumentPdf,
				"auditSystemPdf": auditSystemPdf,
				"evaluationCriterionPdf": evaluationCriterionPdf,
				"riskManagementMechanismPdf": riskManagementMechanismPdf,
				"researchManagementPrincipalDuty": researchManagementPrincipalDuty,
				"researchManagementPrincipalProfessional": researchManagementPrincipalProfessional,
				"researchManagementPrincipalSpecialty": researchManagementPrincipalSpecialty,
				"researchManagementPrincipalCertificatePdf": researchManagementPrincipalCertificatePdf,
				"researchManagementAttorneyDuty": researchManagementAttorneyDuty,
				"researchManagementAttorneyProfessional": researchManagementAttorneyProfessional,
				"researchManagementAttorneySpecialty": researchManagementAttorneySpecialty,
				"researchManagementAttorneyEducation": researchManagementAttorneyEducation,
				"researchManagementAttorneyLimit": researchManagementAttorneyLimit,
				"researchManagementAttorneyExperiencePdf": researchManagementAttorneyExperiencePdf,
				"ethicalTrainingPdf": ethicalTrainingPdf,
				"academicPdf": academicPdf,
				"academicDirectorName": academicDirectorName,
				"academicDirectorDuty": academicDirectorDuty,
				"academicDirectorProfessional": academicDirectorProfessional,
				"academicDirectorSpecialty": academicDirectorSpecialty,
				"academicDirectorUnit": academicDirectorUnit,
				"ethicalPdf": ethicalPdf,
				"ethicalDirectorName": ethicalDirectorName,
				"ethicalDirectorDuty": ethicalDirectorDuty,
				"ethicalDirectorProfessional": ethicalDirectorProfessional,
				"ethicalDirectorSpecialty": ethicalDirectorSpecialty,
				"ethicalDirectorUnit": ethicalDirectorUnit,
				"preparationStandardDevice": preparationStandardDevice,
				"preparationStandardConditionPdf": preparationStandardConditionPdf,
				"studyQualityManagementDocumentRoutine": studyQualityManagementDocumentRoutine,
				"studyQualityManagementDocumentSheet": studyQualityManagementDocumentSheet,
				"studyQualityManagementDocumentElse": studyQualityManagementDocumentElse,
				"auditSystemEvidencePdf": auditSystemEvidencePdf,
				"auditSystemInstitutionPdf": auditSystemInstitutionPdf,
				"evaluationCriterionMonitoringDevice": evaluationCriterionMonitoringDevice,
				"treatmentMeasurePdf": treatmentMeasurePdf,
				"otherRelevantInformation": otherRelevantInformation
			},
			dataType:'html',
			cache:false,
			success:function(data){
				Interceptor(data);
				if(data!=null && data=="success"){
					alert("提交成功，请等待省级管理员审核!");
					location.href='/index/organization_records_search.jsp';
				}
			},
			error:function(error){
				//nexts(tag);
			}
		}); 
    	// 	
    }
}

// 编辑证书
function editCertificate(id) {
	art.dialog.open('/admin/organization_records/win_organization_records_certificate.jsp?id=' + id, {
   	   title: '药物临床试验机构资格认定证书', 
   	   width: 550, 
   	   height: 260, 
   	   fixed: true,
   	   ok: function() {
   	   	    var iframe = this.iframe.contentWindow;
	    	if (!iframe.document.body) {
	        	alert('iframe还没加载完毕呢');
	        	return false;
	        };
	   		var pdf = iframe.document.getElementById('pdf').value;
	   		var certNumber = iframe.document.getElementById('certNumber').value;
	   		var affirmationProfession = iframe.document.getElementById('affirmationProfession').value;
	   		var startDate = iframe.document.getElementById('startDate').value;
	   		var endDate = iframe.document.getElementById('endDate').value;
	   		if(pdf=='') {
	   			alert("PDF文件不能为空!");
	   			return false;
	   		}else if(certNumber=='') {
	   			alert("证书编号不能为空！");
	   			return false;
	   		}else if(affirmationProfession=='') {
	   			alert("认定专业不能为空!");
	   			return false;
	   		}else if(startDate=='') {
	   			alert("起始日期不能为空!");
	   			return false;
	   		}else if(endDate=='') {
	   			alert("终止日期不能为空!");
	   			return false;
	   		}else {
	   			$.ajax({
					url : '/admin/org!editCertificate.action',
					type : 'post',
					dataType : 'text',
					//使用同步的方式,true为异步方式
					async: false,
					data : {
						'id' : id,
						'pdf' : pdf,
						'certNumber':certNumber,
						'affirmationProfession':affirmationProfession,
						'startDate':startDate,
						'endDate':endDate
					},
					success : function(data) {
					 	if(data=='success') {
					 		alert("编辑成功！");
					 		getCertificateList();
					 	}else if(data=='success') {
					 		alert("编辑失败，请先保存备案信息！");
					 		return false;
					 	}
					},
					error : function() {
						// 
					}
				});
	   		}
	   		//
   	   },
   	   cancel: true 
   });
}

// 查询证书列表
function getCertificateList() {
	var status = $("#status").val();
	$.ajax({
		url : '/admin/org!getCertificateList.action',
		type : 'post',
		dataType: 'json',
		success : function(data) {
			 var resultContent = '<tr>'
						      	+'<th style="text-align: left; width: 20%">证书编号</th>'
						      	+'<th style="text-align: left;">认定专业</th>'
						      	+'<th style="text-align: left;">有效期</th>'
						      	+'<th style="text-align: left;">PDF文件</th>'
						      	+'<th style="text-align: left;">操作</th>'
						      +'</tr>';
		     $(data).each(function(i) {
		     	 var statusStr = '';
		     	 if(status=='0' || editStatus=='-1') {
		     	 	statusStr = '<a href="javascript:void(0)" onclick="editCertificate(' + data[i].id + ')">更新</a>&nbsp; '
				        +	'<a href="javascript:void(0)" onclick="deleteCertificate(' + data[i].id + ')">删除</a>';
		     	 }else {
		     	 	statusStr = '无';
		     	 }
		    	 resultContent+='<tr>'
				        +'<td>' + data[i].certNumber + '</td>'
				        +'<td>' + data[i].affirmationProfession + '</td>'
				        +'<td>' + data[i].startDate + ' 至 ' + data[i].endDate + '</td>'
				        +'<td><a href="' + data[i].pdf + '" target="_blank" >查看/下载</a></td>'
				        +'<td>'
				        + statusStr	
				        +'</td>'
				      +'</tr>';
		     });
		     if(data==null || data=='') {
		     	 resultContent+='<tr><td colspan="5" style="text-align:center; height:40px;">数据为空！</td></tr>';
		     }
		     $("#certificate_data").html(resultContent);
		},
		error : function(X) {
			// 失败
		}
    });
}

// 删除证书
function deleteCertificate(id) {
	if(confirm('您确定要删除么?')) {
		$.ajax({
			url : '/admin/org!deleteCertificate.action',
			type : 'post',
			data: {
				"id": id
			},
			dataType: 'html',
			success : function(data) {
			     if(data!=null && data=='success') {
			    	 getCertificateList();
			     }
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				// 保存失败
				alert('error:' + textStatus);
			}
	    });
	}
}

/* 项目管理 s */
// 编辑证书
function editAssumeProject(id) {
	art.dialog.open('/admin/organization_records/win_organization_records_assume_project.jsp?id=' + id, {
   	   title: '机构承担项目情况', 
   	   width: 570, 
   	   height: 360, 
   	   fixed: true,
   	   ok: function() {
   	   	    var iframe = this.iframe.contentWindow;
	    	if (!iframe.document.body) {
	        	alert('iframe还没加载完毕呢');
	        	return false;
	        };
	   		var projectType = iframe.document.getElementById('projectType').value;
	   		var projectName = iframe.document.getElementById('projectName').value;
	   		var projectNumber = iframe.document.getElementById('projectNumber').value;
	   		var principal = iframe.document.getElementById('principal').value;
	   		var expenditure = iframe.document.getElementById('expenditure').value;
	   		var leaderUnit = iframe.document.getElementById('leaderUnit').value;
	   		var participationUnit = iframe.document.getElementById('participationUnit').value;
	   		if(projectType=='') {
	   			alert("项目类型不能为空!");
	   			return false;
	   		}else if(projectName=='') {
	   			alert("项目名称不能为空！");
	   			return false;
	   		}else if(projectNumber=='') {
	   			alert("项目编号不能为空!");
	   			return false;
	   		}else if(principal=='') {
	   			alert("负责人不能为空!");
	   			return false;
	   		}else if(expenditure=='') {
	   			alert("经费（万）不能为空!");
	   			return false;
	   		}else if(leaderUnit=='') {
	   			alert("单位类型不能为空!");
	   			return false;
	   		}else {
	   			$.ajax({
					url : '/admin/org!editAssumeProject.action',
					type : 'post',
					dataType : 'text',
					//使用同步的方式,true为异步方式
					async: false,
					data : {
						'id' : id,
						'projectType' : projectType,
						'projectName':projectName,
						'projectNumber':projectNumber,
						'principal':principal,
						'leaderUnit':leaderUnit,
						'participationUnit':participationUnit,
						'expenditure':expenditure
					},
					success : function(data) {
					 	if(data=='success') {
					 		alert("编辑成功！");
					 		getAssumeProjectList();
					 	}else if(data=='success') {
					 		alert("编辑失败，请先保存备案信息！");
					 		return false;
					 	}
					},
					error : function() {
						// 
					}
				});
	   		}
	   		//
   	   },
   	   cancel: true 
   });
}

// 查询证书列表
function getAssumeProjectList() {
	var status = $("#status").val();
	$.ajax({
		url : '/admin/org!getAssumeProjectList.action',
		type : 'post',
		dataType: 'json',
		success : function(data) {
			 var resultContent = '<tr>'
						      	+'<th style="text-align: left;">项目类型</th>'
						      	+'<th style="text-align: left;">项目名称</th>'
						      	+'<th style="text-align: left;">项目编号</th>'
						      	+'<th style="text-align: left;">负责人</th>'
						      	+'<th style="text-align: left;">经费（万）</th>'
						      	+'<th style="text-align: left;">单位类型</th>'
						      	+'<th style="text-align: left;">参与单位名单</th>'
						      	+'<th style="text-align: left;">操作</th>'
						      +'</tr>';
		     $(data).each(function(i) {
		     	 var statusStr='';
		     	 if(status=='0' || editStatus=='-1') {
		     	 	statusStr = '<a href="javascript:void(0)" onclick="editAssumeProject(' + data[i].id + ')">更新</a>&nbsp; '
				        +	'<a href="javascript:void(0)" onclick="deleteAssumeProject(' + data[i].id + ')">删除</a>';
		     	 }else {
		     	 	statusStr = '无';
		     	 }
		    	 resultContent+='<tr>'
				        +'<td>' + data[i].projectType + '</td>'
				        +'<td>' + data[i].projectName + '</td>'
				        +'<td>' + data[i].projectNumber + '</td>'
				        +'<td>' + data[i].principal + '</td>'
				        +'<td>' + data[i].expenditure + '</td>'
				        +'<td>' + data[i].leaderUnit + '</td>'
				        +'<td>' + data[i].participationUnit + '</td>'
				        +'<td>'
				        + statusStr	
				        +'</td>'
				      +'</tr>';
		     });
		     if(data==null ||data=='') {
		     	 resultContent+='<tr><td colspan="8" style="text-align:center; height:40px;">数据为空！</td></tr>';
		     }
		     $("#assume_project_data").html(resultContent);
		},
		error : function(X) {
			// 失败
		}
    });
}

// 删除证书
function deleteAssumeProject(id) {
	if(confirm('您确定要删除么?')) {
		$.ajax({
			url : '/admin/org!deleteAssumeProject.action',
			type : 'post',
			data: {
				"id": id
			},
			dataType: 'html',
			success : function(data) {
			     if(data!=null && data=='success') {
			    	 getAssumeProjectList();
			     }
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				// 保存失败
				alert('error:' + textStatus);
			}
	    });
	}
}
/* 项目管理 e */


/* 内审 s */
// 编辑
function editInternalAudit(id) {
	art.dialog.open('/admin/organization_records/win_organization_records_internal_audit.jsp?id=' + id, {
   	   title: '内审人员', 
   	   width: 550, 
   	   height: 200, 
   	   fixed: true,
   	   ok: function() {
   	   	    var iframe = this.iframe.contentWindow;
	    	if (!iframe.document.body) {
	        	alert('iframe还没加载完毕呢');
	        	return false;
	        };
	   		var memberName = iframe.document.getElementById('memberName').value;
	   		var specialty = iframe.document.getElementById('specialty').value;
	   		var department = iframe.document.getElementById('department').value;
	   		if(memberName=='') {
	   			alert("内审人员姓名不能为空!");
	   			return false;
	   		}else if(specialty=='') {
	   			alert("专业不能为空！");
	   			return false;
	   		}else if(department=='') {
	   			alert("工作部门不能为空!");
	   			return false;
	   		}else {
	   			$.ajax({
					url : '/admin/org!editInternalAudit.action',
					type : 'post',
					dataType : 'text',
					//使用同步的方式,true为异步方式
					async: false,
					data : {
						'id' : id,
						'memberName' : memberName,
						'specialty':specialty,
						'department':department
					},
					success : function(data) {
					 	if(data=='success') {
					 		alert("编辑成功！");
					 		getInternalAuditList();
					 	}else if(data=='success') {
					 		alert("编辑失败，请先保存备案信息！");
					 		return false;
					 	}
					},
					error : function() {
						// 
					}
				});
	   		}
	   		//
   	   },
   	   cancel: true 
   });
}

// 查询列表
function getInternalAuditList() {
	var status = $("#status").val();
	$.ajax({
		url : '/admin/org!getInternalAuditList.action',
		type : 'post',
		dataType: 'json',
		success : function(data) {
			 var resultContent = '<tr>'
						      	+'<th style="text-align: left;">内审人员姓名</th>'
						      	+'<th style="text-align: left;">专业</th>'
						      	+'<th style="text-align: left;">工作部门</th>'
						      	+'<th style="text-align: left;">操作</th>'
						      +'</tr>';
		     $(data).each(function(i) {
		     	 var statusStr = '';
		     	 if(status=='0' || editStatus=='-1') {
		     	 	statusStr = '<a href="javascript:void(0)" onclick="editInternalAudit(' + data[i].id + ')">更新</a>&nbsp; '
				        +	'<a href="javascript:void(0)" onclick="deleteInternalAudit(' + data[i].id + ')">删除</a>';
		     	 }else {
		     	 	statusStr = '无';
		     	 }
		    	 resultContent+='<tr>'
				        +'<td>' + data[i].memberName + '</td>'
				        +'<td>' + data[i].specialty + '</td>'
				        +'<td>' + data[i].department + '</td>'
				        +'<td>'
				        + statusStr	
				        +'</td>'
				      +'</tr>';
		     });
		     if(data==null ||data=='') {
		     	 resultContent+='<tr><td colspan="4" style="text-align:center; height:40px;">数据为空！</td></tr>';
		     }
		     $("#internal_audit_data").html(resultContent);
		},
		error : function(X) {
			// 失败
		}
    });
}

// 删除
function deleteInternalAudit(id) {
	if(confirm('您确定要删除么?')) {
		$.ajax({
			url : '/admin/org!deleteInternalAudit.action',
			type : 'post',
			data: {
				"id": id
			},
			dataType: 'html',
			success : function(data) {
			     if(data!=null && data=='success') {
			    	 getInternalAuditList();
			     }
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				// 保存失败
				alert('error:' + textStatus);
			}
	    });
	}
}
/* 内审 e */

/* 委员 s */
// 编辑
function editCommittee(id,memberType,committeeType) {
	art.dialog.open('/admin/organization_records/win_organization_records_committee.jsp?id=' + id, {
   	   title: '编辑委员', 
   	   width: 550, 
   	   height: 280, 
   	   fixed: true,
   	   ok: function() {
   	   	    var iframe = this.iframe.contentWindow;
	    	if (!iframe.document.body) {
	        	alert('iframe还没加载完毕呢');
	        	return false;
	        };
	   		var memberName = iframe.document.getElementById('memberName').value;
	   		var duty = iframe.document.getElementById('duty').value;
	   		var professional = iframe.document.getElementById('professional').value;
	   		var specialty = iframe.document.getElementById('specialty').value;
	   		var unit = iframe.document.getElementById('unit').value;
	   		if(memberName=='') {
	   			alert("姓名不能为空!");
	   			return false;
	   		}else if(duty=='') {
	   			alert("职务不能为空！");
	   			return false;
	   		}else if(professional=='') {
	   			alert("职称不能为空!");
	   			return false;
	   		}else if(specialty=='') {
	   			alert("专业不能为空!");
	   			return false;
	   		}else if(unit=='') {
	   			alert("单位不能为空!");
	   			return false;
	   		}else {
	   			$.ajax({
					url : '/admin/org!editCommittee.action',
					type : 'post',
					dataType : 'text',
					//使用同步的方式,true为异步方式
					async: false,
					data : {
						'id' : id,
						'memberName' : memberName,
						'duty':duty,
						'professional':professional,
						'specialty':specialty,
						'unit':unit,
						'memberType':memberType,
						'committeeType':committeeType
					},
					success : function(data) {
					 	if(data=='success') {
					 		alert("编辑成功！");
					 		getCommitteeList(memberType,committeeType);
					 	}else if(data=='success') {
					 		alert("编辑失败，请先保存备案信息！");
					 		return false;
					 	}
					},
					error : function() {
						// 
					}
				});
	   		}
	   		//
   	   },
   	   cancel: true 
   });
}

// 查询列表
function getCommitteeList(memberType,committeeType) {
	var status = $("#status").val();
	$.ajax({
		url : '/admin/org!getCommitteeList.action',
		type : 'post',
		dataType: 'json',
		data:{
			"memberType": memberType,
			"committeeType": committeeType
		},
		success : function(data) {
			 var weiyuanStr = '';
			 if(memberType=='1' && committeeType=='1') {
			 	weiyuanStr = '副主任委员姓名';
			 }else if(memberType=='2' && committeeType=='1') {
			 	weiyuanStr = '委员姓名';
			 }else if(memberType=='1' && committeeType=='2') {
			 	weiyuanStr = '副主任委员姓名';
			 }else if(memberType=='2' && committeeType=='2') {
			 	weiyuanStr = '委员姓名';
			 }
			 var resultContent = '<tr>'
						      	+'<th style="text-align: left;" width="15%">' + weiyuanStr + '</th>'
						      	+'<th style="text-align: left;" width="15%">职务</th>'
						      	+'<th style="text-align: left;" width="15%">职称</th>'
						      	+'<th style="text-align: left;" width="15%">专业</th>'
						      	+'<th style="text-align: left;">单位</th>'
						      	+'<th style="text-align: left;" width="15%">操作</th>'
						      +'</tr>';
		     $(data).each(function(i) {
		     	 var statusStr = '';
		     	 if(status=='0' || editStatus=='-1') {
		     	 	statusStr = '<a href="javascript:void(0)" onclick="editCommittee(' + data[i].id + ',' + memberType +',' + committeeType + ')">更新</a>&nbsp; '
				        +	'<a href="javascript:void(0)" onclick="deleteCommittee(' + data[i].id + ',' + memberType +',' + committeeType + ')">删除</a>';
		     	 }else {
		     	 	statusStr = '无'; 
		     	 }
		    	 resultContent+='<tr>'
				        +'<td>' + data[i].memberName + '</td>'
				        +'<td>' + data[i].duty + '</td>'
				        +'<td>' + data[i].professional + '</td>'
				        +'<td>' + data[i].specialty + '</td>'
				        +'<td>' + data[i].unit + '</td>'
				        +'<td>'
				        + statusStr
				        +'</td>'
				      +'</tr>';
		     });
		     if(data==null ||data=='') {
		     	 resultContent+='<tr><td colspan="4" style="text-align:center; height:40px;">数据为空！</td></tr>';
		     }
		     $("#committee_data_" + memberType + "_" + committeeType).html(resultContent);
		},
		error : function(X) {
			// 失败
		}
    });
}

// 删除
function deleteCommittee(id,memberType,committeeType) {
	if(confirm('您确定要删除么?')) {
		$.ajax({
			url : '/admin/org!deleteCommittee.action',
			type : 'post',
			data: {
				"id": id
			},
			dataType: 'html',
			success : function(data) {
			     if(data!=null && data=='success') {
			    	 getCommitteeList(memberType,committeeType);
			     }
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				// 保存失败
				alert('error:' + textStatus);
			}
	    });
	}
}
/* 委员 e */
